//
//  UIView+Addtion.swift
//  DSHCMerchant
//
//  Created by 罗德良 on 2018/4/13.
//  Copyright © 2018年 袋鼠好车. All rights reserved.
//

import Foundation
import UIKit
///分类扩展
//MARK: UIView
extension UIView {
    
    func border(width: CGFloat, color: CGColor) -> Void {
        self.layer.borderColor = color
        self.layer.borderWidth = width
    }
    
    func roundCorner(radius: CGFloat) -> Void {
        self.layer.cornerRadius = radius
        self.layer.masksToBounds = true
    }
    
    func roundCorners(_ corners: UIRectCorner, size: CGSize) -> Void {
        let maskPath = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: size)
        let masklayer = CAShapeLayer()
        masklayer.frame = self.bounds
        masklayer.path = maskPath.cgPath
        self.layer.mask = masklayer
    }
    
    class func creatFromNIB(By name: String) -> Any? {
        return Bundle.main.loadNibNamed(name, owner: nil, options: nil)?.last
    }
    
}
